
// const COLUMNS = [
// 	{prop:"writeway", label:"签约方式",width:"70"},
// 	{prop:"zhiwei", label:"职位",width:"70"},
// 	{prop:"yewu", label:"业务",width:"70"},
// 	{prop:"yeji", label:"业绩范围",width:"100"},
// 	{prop:"total", label:"统计范围",width:"100"},
// 	{prop:"tidian", label:"提点",width:"100"}
// 	]
// const teamCOLUMNS= [
// 	{prop:"writeway", label:"签约方式",width:"70"},
// 	{prop:"zhiwei", label:"职位",width:"70"},
// 	{prop:"yewu", label:"业务",width:"70"},
// 	{prop:"yeji", label:"业绩范围",width:"100"},
// 	{prop:"total", label:"统计范围",width:"100"},
// 	{prop:"tidian", label:"提点",width:"100"}
// 	]
const queryFormRules= {
	date: [
	    {required: true, message: '请输入月份范围', trigger: 'blur'}
	]};			
let app = new Vue({
    el: "#app",
    data() {
        return {
        	leftbar_show:true,
			tableHeight:window.innerHeight - 180,
			dialogFormVisible:false,
			queryFormRules,
			queryForm:{
				userid: localStorage.getItem('USERID'),
                yourname: "",
				status:[],
				date:[],
				pageNo:1, // 当前页码
				pagesize:100 ,// 每页记录数
				pagesizes:[10,20,50,100,500]				
			},
			pagetotal:0,
			pickerOptions: {
			  shortcuts: [{
				text: '最近一周',
				onClick(picker) {
				  const end = new Date()
				  const start = new Date()
				  start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
				  picker.$emit('pick', [start, end])
				}
			  }, {
				text: '最近一个月',
				onClick(picker) {
				  const end = new Date();
				  const start = new Date();
				  start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
				  picker.$emit('pick', [start, end]);
				}
			  }, {
				text: '最近三个月',
				onClick(picker) {
				  const end = new Date();
				  const start = new Date();
				  start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
				  picker.$emit('pick', [start, end]);
				}
			  }]
			},
			 TheSalary: [{
			            number: '2021-04',
			            name: '陈大龙',
			            bumen: '市场部',
						gangwei: '总监',
						dixin: '1620',
						gwgongzi: '3980',
						quanqin: '200',
						baomi: '200',
						jixiao: '0',
						jcheji: '5600',
						person: '633',
						team: '147.10',
						yfheji: '6780.10'
			          }, {
			            number: '2021-04',
			            name: '王倩',
			            bumen: '会计部',
						gangwei: '会计',
						dixin: '1300',
						gwgongzi: '2500',
						quanqin: '200',
						baomi: '0',
						jixiao: '0',
						jcheji: '4320'		
			          }, {
			            number: '2021-04',
			            name: '季洁',
			            bumen: '市场部',
						gangwei: '市场专员',
						dixin: '1000',
						gwgongzi: '4000',
						quanqin: '200',
						baomi: '0',
						jixiao: '0',
						jcheji: '4500'
			          }, {
			            number: '2021-04',
			            name: '程闪闪',
			            bumen: '市场部',
						gangwei: '市场专员',
						dixin: '1200',
						gwgongzi: '2500',
						quanqin: '200',
						baomi: '0',
						jixiao: '0',
						jcheji: '5320'
			          }],
			importForm: {
				src:"工商",
				assignetype:"手动",
				deptid:parseInt(localStorage.getItem('DEPTID'))
			},			
			form: {name: '',region: '',date1: ''},																				
			pagedata:[],  // 当前页结果集
			statuses:['在职','离职'],
			workpalces: ['公司','家'],
			onlines: ['是','否'],
			writenames: ['是','否'],
			bumens:['市场部','IT部','会计部','人事部','财务部'],
			action:" ",

			innerVisible: false,
			imgdialogVisible:false,
			tabdistributevalue: "base",
			addSalary: true,
			imgdialogImageUrl:''
        }
    },
	methods: {
		// 显示侧边栏
		showLeftBar() {
			if (this.leftbar_show) {
				this.leftbar_show = false
			} else {
				this.leftbar_show = true
			}
		},	
		start(){
			this.queryForm.pageNo = 1
			this.query()
		},
		 onSubmit() {
		        console.log('submit!');
		      },
		selectionChange(selection){
			this.selection = selection
		},
		handleSelectionChange(val) {
			this.multipleSelection = val;
		},		
		// 查询
		async query() {
			// 显示加载框
			const loading = this.$loading(LOAD_STYLE);
			try {
				let res = await axios.post('api/payform/query', this.queryForm);
				if (res.code === 200) {
					this.pagedata = res.data;
					this.pagetotal = res.total;
					this.$message.success(res.message);
				}else {
					this.$message.error(res.message);
				}
			}catch (e) {
				this.$message.error('查询请求出错！', e.message);
			}
			
			// 关闭加载框
			loading.close();
		},



		// 设定表格当前页
		handleCurrentPageChange (selectedPageNo) {
		  this.queryForm.pageNo = selectedPageNo
		  // 加载数据页
		  this.query()
		},

	},
	async mounted() {
		// 自动调整表格高度
		window.onresize = () => {
		  return (() => {
			this.tableHeight = window.innerHeight - 180
		  })()
		}

	}
});	